Geoworks SDK FAQ
Kategorie:Geos SDK ProblemeGeoworks SDK FAQ (Stand: Dezember 1998) This is a list of the most likely questions that new GEOS developers will have when they begin programming for GEOS. For a searchable set of "Less Frequently Asked Questions" check out the Knowledge Base. Q. Can I use the Nokia SDK on Windows 95? A. You can use the compiler on Windows 95, but the SDK's debugging emulator only works on Windows NT. Since debugging is the most critical part of application development, we do not recommend you use the SDK on Windows 95. Q. When can I use the neverSaved option for declaring a subclass? A. The neverSaved option is only meaningful for ProcessClass because the process class does not have instance data, so it should not (cannot) be saved to state. Q. Is it safe to assume that a call to DBFree will not result in moving of any locked item blocks or items? A. Yes, it is safe. In fact, any calls to MemFree, LMemFree, etc. are safe. The only way a locked block (and therefore a locked DBItem) can be moved is by explicitly resizing the block. For DB item blocks, this would mean calling DBReAlloc. Q. So what is the the theory behind EC code? How much is good, and how much is too much? A. Put in as much EC code as possible. It is great for catching bugs now and in the future (when some other poor soul is maintaining the code). A good basic rule is to check all parameters coming into a function and all values returned from a function call. Also checking global variables before passing them to a function is a good ide The non-EC version of EC routines are just stubs that immediately return, so EC code will have minimal impact on your application's performance. Additionally, you can encapsulate EC routines in the EC() macro, which will prevent even the stub from being called when you compile for non-EC. Q. How to I get error information for FileOpen or any of the FileXxx routines? A. For most FileXxx() routines, you can use ThreadGetError() to get the error of code specifying what went wrong. Q. How do I get my own manufacturer ID number? A. You can email a request specifically for a "manufacturer ID" to orders@geoworks.com and a new number will be sent to you. Q. The Concepts book mentions the @if and @endif directives, but no @else. Is there one? A. Yes. For whatever reason, the @else didn't make it into the documentation. It is available and works just like a #else only it's used with code that contains @ symbols (just as the @if directive is used with code containing @ symbols). Q. What is the best way to make a dialog scrollable when it is too big to fit into a screen? For example, Palm address book UI provides for the address entry fields vertical scrolling if you choose to view all the fields. A. Use a GenContent inside of a GenView. Then GenContent is designed to allow you to have a bunch of Gen objects that could scroll inside of a view. Q. How can I reposition a modal dialog box? A. Modal dialog boxes are automatically centered on the screen by the specific UI. This could be overridden using HINT_POSITION_WINDOW_AT_RATIO_OF_PARENT or another _WINDOW_ hint. Q. How can I get the screen width and height on any system? A. There is no specific API to get general system metric information. For your specific request to get the screen width and height, you will need to do use MSG_GEN_GUP_CALL_OBJECT_OF_CLASS to send MSG_VIS_GET_BOUNDS to the GenFieldClass. MSG_VIS_GET_BOUNDS returns the current bounds of an object in a variable of type Rectangle. The GenField object is kind of a backdrop that everything else sits on. (Section 28.4 of the Objects 3 book (Objects\OSysObj.txt) describes the GenFieldClass in more detail.) Q. I am using ObjInstaniate to create objects. Once I no longer need them, how do I destroy them? A. For Gen objects: MSG_GEN_DESTROY For Vis objects: MSG_VIS_DESTROY If your object is not a Gen or Vis subclass: MSG_META_OBJ_FREE Q. I've got a bad pointer and/or handle floating around in my app and I'm trying to use Swat to track it down. A. Look up the documentation of the 'ec' command in Swat (type 'help ec' inside of Swat and/or look at page 109 in the Tools book). The idea is for you to use various ec flag settings to get specific help from the system itself in... * locating the bug directly and * forcing the bug to manifest itself sooner and/or reliably. Q. I'm compiling an app and strange things seem to be happening. Messages get sent to objects but the objects don't execute the message handlers. By the way, I'm using Borland C++ 5.0. A. In Borland 5.0, #pragma option -a no longer aligns on word boundaries in the context that we use. GEOS requires that class method tables be word-aligned. The best way to avoid this problem is to use an earlier version of the compiler; version 4.5, included with most distributions, is recommended. If you must use version 5.0, you will find that classes with an odd number of methods will cause subsequent class method tables in the same .obj file to be aligned incorrectly. This problem becomes apparent at run time, when methods fail to execute. You can work around this aspect of the problem by defining classes with an even number of methods only, declaring a "dummy" method at the end if necessary. Global variables declared or inserted before the class method tables can also cause misalignment. A misaligned class method table can be diagnosed with Swat; when a class's methods are listed with the "methods" command, a failure to report the method names indicates a misaligned table. Q. What compilers can I use with the GEOS SDK? A. Only the Borland C++ compilers version 4.0 through 4.52 are supported at this point in time. Borland C++ version 5.0 can be used, but it has some bugs in it that you must be aware of (see the article in our knowledge database by searching on keyword "bcc,5.0"). No other compilers are currently supported. Specifically, neither Microsoft C++ nor Borland Turbo C++ are supported. Borland C++ 3.1 does not support 32-bit compiling and also cannot be used with the GEOS SDK for Windows NT. Kategorie:FAQs